//
//  EditingInfoCell.m
//  囧途而行
//
//  Created by 杨璟 on 16/5/17.
//  Copyright © 2016年 YSKJ. All rights reserved.
//

#import "EditingInfoCell.h"
#import "JTUser.h"

#import "UIImageView+WebCache.h"

@interface EditingInfoCell ()

@property (weak, nonatomic) IBOutlet UIImageView *icon;

@property (weak, nonatomic) IBOutlet UILabel *infoLabel;

@property (nonatomic, strong) NSArray *selections;

@end

@implementation EditingInfoCell

- (NSArray *)selections {
    if (!_selections) {
        _selections = @[@"修改头像", @"修改昵称", @"修改性别"];
    }
    return _selections;
}

- (void)setRow:(NSInteger)row {
    _row = row;
    
    self.textLabel.text = self.selections[row];
    
    switch (row) {
        case 0:
            self.icon.hidden = NO;
            self.infoLabel.hidden = YES;
            self.icon.image = [UIImage imageWithData:self.editingUser.icon];
            break;
        case 1:
            self.icon.hidden = YES;
            self.infoLabel.hidden = NO;
            self.infoLabel.text = self.editingUser.nickname;
            break;
        case 2:
            self.icon.hidden = YES;
            self.infoLabel.hidden = NO;
            self.infoLabel.text = self.editingUser.gender;
            break;
        default:
            break;
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.icon.layer.cornerRadius = 20;
    self.icon.layer.masksToBounds = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
